package com.pan.admin.quartz.task;

import com.pan.admin.quartz.service.ISysJobLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 *  调度任务日志任务
 *
 *  @author caoxin
 */
@Component("quartzLogTask")
public class QuartzLogTask {

    @Autowired
    private ISysJobLogService jobLogService;

    /**
     *  删除调度日志任务，只保留三天之内的日志
     */
    public void cleanJobLogTask() {
        LocalDateTime date = LocalDateTime.now().minusDays(3);
        jobLogService.cleanJobLogBeforeDate(date);
    }

}
